package com.yixiu.study.juc.threadpool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @CalssName T01_SingleThreadPool
 * @Description
 * @Author yixiu
 * @Date 2021/6/29 10:42
 * @Verison 1.0
 **/
public class T01_SingleThreadPool {

    public static void main(String[] args) {
        ExecutorService service = Executors.newSingleThreadExecutor();
        for (int i = 0; i < 5; i++) {
            final int j = i;
            service.execute(() -> {
                System.out.println(j + " " + Thread.currentThread().getName());
            });
        }
    }

}
